using System.ServiceModel.Syndication;
using aprogblog.Domain.Classes;
using aprogblog.Domain.Helpers;
using aprogblog.Specs.Helpers;
using FluentSpec;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace aprogblog.Specs {

    [TestClass]
    public class when_deleting_an_Entry {
        
        const string Id = Actors.TheExpectedEntryId;
        
        [TestClass]
        public class a_WeblogService : BehaviorOfWeblogService {
            
            [TestMethod]
            public void should_remove_it_from_the_Blog() {
                
                When.DeletePost(null, Id, null, null, false);
                Then.Blog.Should().Delete(Id);
            }
        }
        
        [TestClass]
        public class a_Blog : BehaviorOf<BlogClass> {
        
            static readonly SyndicationItem TheRemovedItem = Actors.TheExpectedEntry.ToItem();
            
            [TestInitialize]
            public void SetUp() {
                Given.Feed.Is(Actors.FeedWithTheExpectedEntry);
                When.Delete(Id);
            }
            
            [TestMethod]
            public void should_remove_it() {
                
                Then.Feed.Items.ShouldNotContain(TheRemovedItem);
            }
            
            [TestMethod]
            public void should_be_saved() {

                Should.Save();
            }
        }
    }
}